package com.example.owner.lettery1.utils

import android.app.Application
import android.util.Log

open class CoreApplication : Application() {

    companion object {
        var instance: CoreApplication? = null
    }

    override fun onCreate() {
        super.onCreate()
        instance = this

    }
    fun getAppVersionName(): String {
        var versionName: String? = ""
        try {
            val pm = instance!!.packageManager
            val pi = pm.getPackageInfo(instance!!.packageName, 0)
            versionName = pi.versionName
            if (versionName == null || versionName.isEmpty()) {
                return ""
            }
        } catch (e: Exception) {
            Log.e("VersionInfo", "Exception", e)
        }

        return versionName!!
    }

}